home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
United Public Domain Gold 2
/
United Public Domain Gold 2.iso
/
utilities
/
pu546.dms
/
pu546.adf
/
Planets
/
Julday.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-09-23
|
867b
|
27 lines
/*******************************************************************************
** Compute the Julian Date from a given local date. **
** Sorry, Bob. Your routine didn't seem to work correctly. **
*******************************************************************************/
#include <stdio.h>
#include <math.h>
double julday(day,month,year,hour)
int day,month,year;
double hour;
{
double a;
long to_long();
int b;
a = 10000.*year+100.*month+(double)day;
if(month<=2) {
month += 12; year -= 1;
}
if(a <= 15821004.1)
b = -2 + (int)to_long((year+4716)/4.) - 1179;
else
b = (int)(to_long(year/400.) - to_long(year/100.) + to_long(year/4.));
a = 365.*year-679004.+2400000.5;
return(a+(double)b+(double)to_long(30.6001*(month+1))+(double)day+hour/24.);
}